package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.Objects;

@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 统计上下架商品统计
     *
     * @return
     */
    @GetMapping("/productUpOrDown")
    public Result getProductUpOrDown() {
        List<Map<String, Objects>> dataList = reportService.getProductUpOrDown();
        return Result.success(dataList);
    }


    /**
     * 各个状态的商品数量统计
     *
     * @return
     */
    @GetMapping("/productStatus")
    public Result getProductStatus() {
        List<Map<String, Objects>> dataList = reportService.getProductStatus();
        return Result.success(dataList);
    }
}
